<html>
<head><meta charset="utf-8"><title>Usage for cross-compiling · t-compiler/rust-analyzer · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/index.html">t-compiler/rust-analyzer</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Usage.20for.20cross-compiling.html">Usage for cross-compiling</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="195352970"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Usage%20for%20cross-compiling/near/195352970" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simlay <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Usage.20for.20cross-compiling.html#195352970">(Apr 26 2020 at 21:14)</a>:</h4>
<p>Hey, so I'm interested in how to setup rust-analyzer for different targets. I've got <code>.cargo/config</code> to include</p>
<div class="codehilite"><pre><span></span>[build]
target = &quot;x86_64-apple-darwin&quot;
</pre></div>


<p>but it doesn't seem to result in rest-analyzer working on the correct target. Is there a github issue for this maybe?</p>



<a name="195353096"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Usage%20for%20cross-compiling/near/195353096" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Usage.20for.20cross-compiling.html#195353096">(Apr 26 2020 at 21:18)</a>:</h4>
<p>That's a somewhat popular question recently: <a href="#narrow/stream/122651-general/topic/Define.20a.20default.20target/near/195290371" title="#narrow/stream/122651-general/topic/Define.20a.20default.20target/near/195290371">https://rust-lang.zulipchat.com/#narrow/stream/122651-general/topic/Define.20a.20default.20target/near/195290371</a></p>



<a name="195353099"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Usage%20for%20cross-compiling/near/195353099" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Usage.20for.20cross-compiling.html#195353099">(Apr 26 2020 at 21:18)</a>:</h4>
<p>I think it should be pretty easy to fix</p>



<a name="195353102"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Usage%20for%20cross-compiling/near/195353102" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Usage.20for.20cross-compiling.html#195353102">(Apr 26 2020 at 21:18)</a>:</h4>
<p>(the linked discussion shows the places where the fix needs to be applied)</p>



<a name="195353109"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Usage%20for%20cross-compiling/near/195353109" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Usage.20for.20cross-compiling.html#195353109">(Apr 26 2020 at 21:19)</a>:</h4>
<p>cc <span class="user-mention" data-user-id="211727">@Jonas Schievink</span> I <em>think</em>  you might be hitting this as well probably?</p>



<a name="195353115"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Usage%20for%20cross-compiling/near/195353115" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Usage.20for.20cross-compiling.html#195353115">(Apr 26 2020 at 21:19)</a>:</h4>
<p>Not at the moment, but it would be great to have indeed</p>



<a name="195353116"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Usage%20for%20cross-compiling/near/195353116" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Usage.20for.20cross-compiling.html#195353116">(Apr 26 2020 at 21:19)</a>:</h4>
<p>(creating an issue with pointers to code would be appreciated :) )</p>



<a name="195353124"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Usage%20for%20cross-compiling/near/195353124" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simlay <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Usage.20for.20cross-compiling.html#195353124">(Apr 26 2020 at 21:19)</a>:</h4>
<p>oh nice. I'll create an issue.</p>



<a name="195353173"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Usage%20for%20cross-compiling/near/195353173" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Usage.20for.20cross-compiling.html#195353173">(Apr 26 2020 at 21:20)</a>:</h4>
<p>When I work on code that does require setting a target I usually just do <code>cargo check --target xxx</code> in some terminal</p>



<a name="195353204"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Usage%20for%20cross-compiling/near/195353204" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Usage.20for.20cross-compiling.html#195353204">(Apr 26 2020 at 21:21)</a>:</h4>
<p>Yeah, I think it's important to understand that there are two issues here:</p>
<ul>
<li>how we run <code>cargo check</code> (and this is possible to tweak today via settings)</li>
<li>which <code>cfg</code> we use to analyze code (and this I <em>think</em>, is unconditionally host today)</li>
</ul>



<a name="195353245"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Usage%20for%20cross-compiling/near/195353245" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Usage.20for.20cross-compiling.html#195353245">(Apr 26 2020 at 21:22)</a>:</h4>
<p>Although for the second bit I'd expect the <code>[build]</code> in <code>.cargo/confgi</code> to actually fix it....</p>



<a name="195353248"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Usage%20for%20cross-compiling/near/195353248" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Usage.20for.20cross-compiling.html#195353248">(Apr 26 2020 at 21:22)</a>:</h4>
<p>Ahh, that might not be enough, becuase we also query rustc for this info, bypassing cargo</p>



<a name="195353256"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Usage%20for%20cross-compiling/near/195353256" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simlay <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Usage.20for.20cross-compiling.html#195353256">(Apr 26 2020 at 21:23)</a>:</h4>
<p>ah, yes that makes sense.</p>



<a name="195353315"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Usage%20for%20cross-compiling/near/195353315" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Usage.20for.20cross-compiling.html#195353315">(Apr 26 2020 at 21:25)</a>:</h4>
<p>Would be fun to treat <code>#[cfg]</code> like where clauses: When in a function, assume that all <code>#[cfg]</code>s "in scope" are available (ie. on the function or on its containing items/modules) and provide IDE features based on that (enabling any items with a subset of these <code>#[cfg]</code>s).</p>



<a name="195353366"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Usage%20for%20cross-compiling/near/195353366" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Usage.20for.20cross-compiling.html#195353366">(Apr 26 2020 at 21:26)</a>:</h4>
<p>Would be fun to design a language in such a way that conditional compilation happens <em>after</em> name resolution and not before it D:</p>



<a name="195353375"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Usage%20for%20cross-compiling/near/195353375" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Usage.20for.20cross-compiling.html#195353375">(Apr 26 2020 at 21:26)</a>:</h4>
<p>...or in which you wouldn't have to implement a full language interpreter to offer correct completions</p>



<a name="195353388"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Usage%20for%20cross-compiling/near/195353388" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Usage.20for.20cross-compiling.html#195353388">(Apr 26 2020 at 21:27)</a>:</h4>
<p>Well, implementing language interpreter is an easier task than conditional compilation</p>



<a name="195353391"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Usage%20for%20cross-compiling/near/195353391" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Usage.20for.20cross-compiling.html#195353391">(Apr 26 2020 at 21:27)</a>:</h4>
<p>In a sense that constexpr and such have one precise answer</p>



<a name="195353441"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Usage%20for%20cross-compiling/near/195353441" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Usage.20for.20cross-compiling.html#195353441">(Apr 26 2020 at 21:28)</a>:</h4>
<p>With cross-compilation, you sorta-kinda need to merge analysis results from diffierent sets of enabled cfgs, and that is a problem which is much fuzzier</p>



<a name="195354180"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Usage%20for%20cross-compiling/near/195354180" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simlay <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Usage.20for.20cross-compiling.html#195354180">(Apr 26 2020 at 21:50)</a>:</h4>
<p>I submitted <a href="https://github.com/rust-analyzer/rust-analyzer/issues/4163" title="https://github.com/rust-analyzer/rust-analyzer/issues/4163">https://github.com/rust-analyzer/rust-analyzer/issues/4163</a> with relevant words and links</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>